package pdm.traj.util;

import redis.clients.jedis.Jedis;

public class JedisUtil {
	public static void flushdb3Nodes() {
		try {
		Jedis j1 = new Jedis("192.9.200.10", 6379);
		j1.connect();
		j1.flushDB();
		j1.disconnect();
		
		Jedis j2 = new Jedis("192.9.200.172", 6379);
		j2.connect();
		j2.flushDB();
		j2.disconnect();
		
		Jedis j3 = new Jedis("192.9.200.173", 6379);
		j3.connect();
		j3.flushDB();
		j3.disconnect();
		} catch (Exception e) {
			flushdb3Nodes();
		}
	}
	
	public static void flushdb3NodesLocal() {
		try {
		Jedis j1 = new Jedis("192.9.200.158", 6379);
		j1.connect();
		j1.flushDB();
		j1.disconnect();
		
		Jedis j2 = new Jedis("192.9.200.158", 6380);
		j2.connect();
		j2.flushDB();
		j2.disconnect();
		
		Jedis j3 = new Jedis("192.9.200.158", 6381);
		j3.connect();
		j3.flushDB();
		j3.disconnect();
		} catch (Exception e) {
			flushdb3NodesLocal();
		}
	}
}
